/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—05—14
 * Time: 12:11
 */
public class Student01 {
    //普通成员变量
    public String name;
    public String gender;
    public int age;
    public double score;
    //静态成员变量，不属于对象
    //被Static修饰就变成了静态成员，都可以使用这个，变成共享的
    public static String classRoom = "gao yi 13 ban";

    public Student01(String name, String gender, int age, double score) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.score = score;
    }
    public void PrintStudent(){
        System.out.println(name + " " + gender + " " + age + " " + score);
    }

    public static void main1(String[] args) {
        System.out.println(Student01.classRoom);
    }

    public static void main(String[] args) {
        //静态成员可以直接使用类名来访问
        Student01 s1 = new Student01("Zhang san","男",20,4.0);
        Student01 s2 = new Student01("li si","男",21,3.9);
        Student01 s3 = new Student01("Wing wu","男",22,2.9);
        //不建议通过对象的引用去访问
        System.out.println(s1.classRoom);
        System.out.println(s2.classRoom);
        System.out.println(s3.classRoom);
        //建议最好通过类名去访问
        System.out.println(Student01.classRoom);
        //只是通过类名点出来的
        s1.PrintStudent();
        s2.PrintStudent();
        s3.PrintStudent();
        //静态的是通过类名来调用的，不是通过对象来调用的
    }
}
